package lt.isleidau;


import android.app.Activity;
import android.os.Bundle;

import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;

import android.widget.Button;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.Toast;

public class isleidau extends Activity {
    /** Called when the activity is first created. */
	private double bb=0;
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final SeekBar bar = (SeekBar) findViewById(R.id.bar);
        bar.setMax(5000);
        final EditText edittext = (EditText) findViewById(R.id.textas);
        edittext.setOnKeyListener(new OnKeyListener() {
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                // If the event is a key-down event on the "enter" button
                if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
                    (keyCode == KeyEvent.KEYCODE_ENTER)) {
                  // Perform action on key press
                	bb=bb+Double.parseDouble(edittext.getText().toString());
                  Toast.makeText(getApplicationContext(), Double.toString(bb), Toast.LENGTH_SHORT).show();
                  bar.setProgress((int) bb);
                  return true;
                  
                }
                return false;
            }
        });
        Button button = (Button) findViewById(R.id.ok);
        button.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				bb=bb+Double.parseDouble(edittext.getText().toString());
				 Toast.makeText(getApplicationContext(), Double.toString(bb), Toast.LENGTH_SHORT).show();
				 bar.setProgress((int) bb);
			}
		});
      
       
    }
 

	
}